package com.mida.bms.report.api;

import com.mida.bms.report.entity.DocStructReport;
import com.mida.bms.report.vo.ReportSearchRequest;
import com.mida.tool.common.result.ActionResult;
import feign.Logger;
import feign.Response;
import feign.codec.Encoder;
import feign.form.spring.SpringFormEncoder;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.DependsOn;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletResponse;

/**
 * <h1></h1>
 * <p>
 *
 * </p>
 *
 * @author jian.li on 2021/6/26 15:38
 */
@DependsOn("loadFromDatabasePropertyConfig")
@FeignClient(name = "docReportPdfApi",url = "bms.report.feign.url")
public interface DocReportPdfApi {

    /**
     * 保存报告pdf文件
     *
     * @param stReportSoid 报告存储信息标识
     * @param file
     * @return
     */
    @PostMapping(value = "/docReport/savePdf",produces = {"application/json"},consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
    @ResponseBody
    ActionResult savePdf(@RequestParam("stReportSoid") Long stReportSoid, @RequestPart("file") MultipartFile file, @RequestParam("employeeSoid") Long employeeSoid);

    /**
     * 获取报告pdf
     *
     * @param request
     * @return
     */
    @PostMapping("/docReport/gainReportPdf")
    @ResponseBody
    Response gainReportPdf(@RequestBody ReportSearchRequest request);

    /**
     * 据报告soid、返回报告
     *
     * @param request
     * @return
     */
    @PostMapping(value = "/docReport/gainDocReportByStReportSoid")
    @ResponseBody
    DocStructReport gainDocReportByStReportSoid(@RequestBody ReportSearchRequest request);


    /**
     * 获取报告pdfurl
     *
     * @param request
     * @return
     */
    @PostMapping(value ="/docReport/gainReportPdfByStReportSoid")
    @ResponseBody
    String gainReportPdfByStReportSoid(@RequestBody ReportSearchRequest request);
}
